#pragma once

#ifndef VarTable_h
#define VarTable_h

#include <string>
#include <map>
#include "Type.h"

class VarTable{

private:
	typedef std::map<Type::Index::Var, Type::Name::Var> NameTableType;
	typedef std::map<Type::Name::Var, Type::Index::Var> IndexTableType;

	NameTableType nameTable;
	IndexTableType indexTable;

	int index;

public:
	VarTable(void);
	~VarTable(void);
	void clear();

	// insert variable with its name, return variable index
	Type::Index::Var insertVar(Type::Name::Var);

	// get all variable indices
	const Type::List::Var& getVarIndices();
	// get variable index with the given variable name
	Type::Index::Var getVarIndex(Type::Name::Var);

	// get variable name with the given variable index
	Type::Name::Var getVarName(Type::Index::Var);

	// check for variable exsistence with the given variable name
	bool isVarExistsInVarTable(Type::Name::Var);

	// check for variable exsistence witht the given variable index
	bool isVarExistsInVarTable(Type::Index::Var);
};
#endif
